<?php
session_start();
$intercept=true;
if($intercept){
 
   if(!isset($_SESSION['TWI_USR'])){//判断session
 
    header("Location:login.php");
    exit();
  }

}
 
$host = 'localhost';  
  $username='root';  
  $password ='11'; 
  $dbName = 'twilightbar';

 
  $dbConn = mysql_connect($host,$username,$password);
 
  if(!$dbConn){
    echo    'Unable to open database server,please check you connecting paramater.';
    exit();
  }
  
  
  if(!@mysql_select_db($dbName,$dbConn)){
    echo 'Unable to locate database '+$dbName;
    exit();
  }
  
  mysql_query('set names utf8');

 /* header('Content-Type: text/html; charset=utf-8'); 
  
  $sql = 'Select * from user';
  $result = mysql_query($sql);
  
  if(!$result){
    echo 'Error performing query.';
    exit();
  }
  
  while($row = mysql_fetch_array($result)){
    echo $row['username'];
  }
  */
  
  
?>
